package com.mango.data.structure.hash;

import java.util.Arrays;

/**
 * HashSet 测试
 * @Author: mango
 * @Date: 2022/5/22 8:52 上午
 */
public class HSTest {
    public static void main(String[] args) {
        HashSet<String> set = new HashSet<>();
        System.out.println(set);
        set.add("a");
        set.add("b");
        System.out.println(set);
        System.out.println(set.contains("a"));
        for(Object val : set){
            System.out.println(val);
        }
        set.remove("b");
        System.out.println(Arrays.toString(set.toArray(new String[1])));

        for (int i=0;i<10;i++){
            set.add("i"+i);
        }
        System.out.println(set);

        for (int i=0;i<10;i++){
            set.remove("i"+i);
        }
        System.out.println(set);
    }
}
